//
//  SettingViewController.m
//  SIPphone
//
//  Created by wrt on 13-11-11.
//  Copyright (c) 2013年 wrtsoft. All rights reserved.
//

#import "SettingViewController.h"
#import "UserIDSettingViewController.h"
#import "VideoSettingViewController.h"
#import "SoundSettingViewController.h"
#import "InternetSettingViewController.h"
#import "NoteSettingViewController.h"
#import "MsgSettingViewController.h"
#import "callSettingViewController.h"
#import "AlarmSettingViewController.h"
#import "OtherSettingViewController.h"


@interface SettingViewController ()

@end

@implementation SettingViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
        self.title = NSLocalizedString(@"setting", @"设置 Setting");
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
//    self.titleArray = @[@"帐号配置",@"视频配置",@"音频配置",@"网络配置",@"日志配置",@"留言配置",@"呼叫配置",@"报警配置",@"其他设置"];
//    self.imageArray = @[@"账号配置.png",@"视频配置.png",@"音频配置.png",@"网络配置.png",@"日志配置.png",@"留言配置.png",@"呼叫配置.png",@"其他配置.png",@"其他配置.png"];
    self.titleArray = @[NSLocalizedString(@"account settings", @"帐号配置 Account settings"),NSLocalizedString(@"video settings", @"视频配置 Video settings"),NSLocalizedString(@"audio Settings", @"音频配置 Audio Settings"),NSLocalizedString(@"network Settings", @"网络配置 Network Settings"),NSLocalizedString(@"log Settings", @"日志配置 Log Settings"),NSLocalizedString(@"call Settings", @"呼叫配置 Call Settings"),NSLocalizedString(@"alarm settings", @"报警配置 Alarm settings"),NSLocalizedString(@"other settings", @"其他配置 Other settings")];
    self.imageArray = @[@"账号配置.png",@"视频配置.png",@"音频配置.png",@"网络配置.png",@"日志配置.png",@"呼叫配置.png",@"baojingpeizhi.png",@"其他配置.png"];
}

- (void)viewWillAppear:(BOOL)animated
{
    [self.tableView reloadData];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
//    return 9;
    return 8;
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *cellIdentifier = @"moreIdentifer";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
    if (cell == nil)
    {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
        cell.textLabel.text = self.titleArray[indexPath.row];
        cell.imageView.image = [UIImage imageNamed:self.imageArray[indexPath.row]];
        cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    }
    return cell;
}

#pragma mark - Table view delegate
//分别选择哪个按钮会跳转到对应的界面上
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSUInteger row=indexPath.row;
    if (row == 0)
    {
        UserIDSettingViewController *useridVC = [[UserIDSettingViewController alloc] init];
        [self.navigationController pushViewController:useridVC animated:YES];
    }
    else if (row == 1)
    {
        VideoSettingViewController *videoSetting = [[VideoSettingViewController alloc] init];
        [self.navigationController pushViewController:videoSetting animated:YES];
    }
    else if (row == 2)
    {
        SoundSettingViewController *soundSetting = [[SoundSettingViewController alloc] init];
        [self.navigationController pushViewController:soundSetting animated:YES];
    }
    else if (row == 3)
    {
        InternetSettingViewController *internerSet = [[InternetSettingViewController alloc] init];
        [self.navigationController pushViewController:internerSet animated:YES];
    }
    else if (row == 4)
    {
        NoteSettingViewController *noteSet = [[NoteSettingViewController alloc] init];
        [self.navigationController pushViewController:noteSet animated:YES];
    }
//    else if (row == 5)
//    {
//        MsgSettingViewController *msgSet = [[MsgSettingViewController alloc] init];
//        [self.navigationController pushViewController:msgSet animated:YES];
//    }
    else if (row == 5)
    {
        callSettingViewController *callSet = [[callSettingViewController alloc] init];
        [self.navigationController pushViewController:callSet animated:YES];
    }
    else if (row == 6)
    {
        AlarmSettingViewController *alarmSet = [[AlarmSettingViewController alloc] init];
        [self.navigationController pushViewController:alarmSet animated:YES];
    }
    else if (row == 7)
    {
        OtherSettingViewController *otherSet = [[OtherSettingViewController alloc] init];
        [self.navigationController pushViewController:otherSet animated:YES];
    }
}
@end
